function [] = part7()
clc
clear

S = [1 1 1];
O = [1 1];
wrt(S,O);

S = [0 1 0];
O = [0 1];
wrt(S,O);

S = [1 0 1];
O = [1 0];
wrt(S,O);

S = [0 0 0];
O = [0 0];
wrt(S,O);

end

function [] = wrt(S,O)
    p1 = 'p';
    if(S(1))
        s1='+';
    else
        p1 = 'n';
        s1='-';
    end
    p2 = 'p';
    if(S(2))
        s2='+';
    else
        p2 = 'n';
        s2='-';
    end
    p3 = 'p';
    if(S(3))
        s3='+';
    else
        p3 = 'n';
        s3='-';
    end
    if(O(1))
        o1='+';
    else
        o1='-';
    end
    if(O(2))
        o2='+';
    else
        o2='-';
    end
    fprintf('%s%s%s-adder:\n',p1,p2,p3);
    fprintf('%sx %s y %s z = %s2c %s s\n\n',s1,s2,s3,o1,o2);
end
